﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;

namespace CommonHelpers
{
    public class IntegerFormatter : IFormatProvider, ICustomFormatter
    {
        // always use dot separator for doubles
        private CultureInfo enUsCulture = CultureInfo.GetCultureInfo("es-ES");

        public string Format(string format, object arg, IFormatProvider formatProvider)
        {
            return string.Format(enUsCulture, "##,#", arg);
        }

        public object GetFormat(Type formatType)
        {
            return (formatType == typeof(ICustomFormatter)) ? this : null;
        }
    }

}
